package cn.gok;

class Animal{
    private String name;
    private String sex;
    private  String age;
    public void call(){
        System.out.println(this.name+"gousdsa");
    }


    public Animal(String name, String sex, String age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age='" + age + '\'' +
                '}';
    }
}
class Dog extends Animal{
    private int owner;

    public Dog(String name, String sex, String age, int owner) {
        super(name, sex, age);
        this.owner = owner;//特有属性赋值
    }

    //子类对象构造之前，必须先构造父类部分
    public Dog(){
        super("狗","男","2");
    }

    @Override
    public void call() {
        super.call();
        System.out.println("早点睡啊");
    }
}
public class 继承 {
    public static void main(String[] args) {
        Dog dog =new Dog();
        dog.call();

    }
}
